package com.ty.init.controller;

import com.ty.init.pojo.Product;
import com.ty.init.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author ty
 */
@Controller
public class UserControllerTest {
    @Autowired
    private ProductService productService;
    @RequestMapping("login")
    public String Hello(){
        return "login";
    }
    @RequestMapping("index")
    public String Hello01(){
        return "index";
    }
    @RequestMapping("userslist")
    public String productList(){
        return "user/user";
    }

    @RequestMapping("userAdd")
    public String addUser01(){
        return "user/userAdd";
    }
    @RequestMapping("detail")
    public String productMessage(Model model , Integer id){
        Product data = productService.findByID(id);
        model.addAttribute("data",data);
        return "product/productMessage";
    }
    @RequestMapping("productUpdate")
    public String productUpdate(Model model , Integer id){
        Product data = productService.findByID(id);
        model.addAttribute("data",data);
        return "product/productUpdate";
    }
    @RequestMapping("changePassword")
    public String changePassword(){
        return "/user/changePassword";
    }
    @RequestMapping("userAnalyze")
    public String userAnalyze(){
        return "user/userAnalyze";
    }
}
